package homework;

import java.util.Scanner;

public class Test03 {
    //替换某字符串中的某字符串。
    public static void main(String[] args) {
        //创建键盘输入
        Scanner sc = new Scanner(System.in);
        //键盘输入
        System.out.println("请输入源字符串：");
        String srcStr = sc.next();
        System.out.println("请输入要删除的字符串：");
        String delStr = sc.next();

        System.out.println(srcStr.replace(delStr,""));
        System.out.println("源字符串中总共包含："+(srcStr.length()- srcStr.replace(delStr,"").length()+"个"+delStr));//删除的个数
        String newStr = srcStr.replace(delStr,"");
        System.out.println("删除"+delStr+"后的字符串为："+newStr.toString());
    }
}
